package cn.lixin.hrm.context;

import cn.lixin.hrm.domain.UserInfo;
import com.alibaba.fastjson.JSON;
import org.springframework.security.core.context.SecurityContextHolder;

public class UserInfoContextHolder {
    public static UserInfo getUserInfo(){
        String str = SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString();
        UserInfo userInfo = JSON.parseObject(str, UserInfo.class);
        return  userInfo;
    }
}